﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		UserNotificationService.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 // 
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using Dexter.Core.EventArgs;
using Dexter.Domain.Model;
using Dexter.Services;

namespace Dexter.Services.Implementation {
	/// <summary>
	/// 	Implementation of <see cref = "IUserNotificationService" />
	/// </summary>
	public class UserNotificationService : IUserNotificationService {
		protected readonly IConfigurationService ConfigurationService;
		protected readonly IEmailService EmailService;
		protected readonly IEmailTemplateService EmailTemplateService;

		/// <summary>
		/// 	Initializes a new instance of the <see cref = "UserNotificationService" /> class.
		/// </summary>
		/// <param name = "emailService">The email service.</param>
		/// <param name = "configurationService">The configuration service.</param>
		/// <param name = "emailTemplateService">The email template service.</param>
		/// <param name = "userService">The user service.</param>
		public UserNotificationService ( IEmailService emailService , IConfigurationService configurationService , IEmailTemplateService emailTemplateService , IUserService userService ) {
			this.EmailService = emailService;
			this.ConfigurationService = configurationService;
			this.EmailTemplateService = emailTemplateService;
			userService.UserCreated += UserCreated;
			userService.UserDeleted += UserDeleted;
		}

		void UserDeleted ( object sender , GenericEventArgs <User> e ) {
			var template = EmailTemplateService.GetTemplate ( "userService.UserDeleted" );

			//TODO: I've to generate the email body
			EmailService.Queue ( null );

			throw new NotImplementedException ( );
		}

		void UserCreated ( object sender , GenericEventArgs <User> e ) {
			var template = EmailTemplateService.GetTemplate ( "userService.UserCreated" );
			//TODO: I've to generate the email body
			EmailService.Queue ( null );

			throw new NotImplementedException ( );
		}
	}
}
